Hi, |
Re: Copy module between folders When you copy, you don't get Baselines and you don't get embedded Module Triggers. If you want an exact copy you should archive and restore it.
|
Re: Copy module between folders llandale - Wed Jun 16 21:36:57 EDT 2010
Thanks for the reply. I probably didn't explain myself very well. I know how to copy and paste / clone within the DOORS client. I need to carry out the same copy functionality using DXL. The scenario is that the user can create a new 'implementation' through a dialog box, providing the details to create a new 'implementation' folder at the appropriate place in the database. Once this is created, reference modules are copied to the new folder for further specification. I was just having an issue copying the reference modules in the dxl. I have since discovered clipCopy(Item) and clipPaste(Folder) and think that they may do the job once I've figured out how to specify the folder handle. Thanks Mark |
Re: Copy module between folders mwilliamson - Thu Jun 17 02:58:36 EDT 2010 I don't seem to have an example of it, but ModName_ mnFrom = module(NameFromFull) string Description = description(mnFrom) bool OK = copy(ModName_,string NameToBase, string Description) ModName mnTo = module(full name of NameToBase) string ErrMess = move(ModName_,Folder) string ErrMess = rename(ModName_,string NameToBase,string Description)
|
Re: Copy module between folders llandale - Thu Jun 17 11:59:30 EDT 2010 I don't seem to have an example of it, but ModName_ mnFrom = module(NameFromFull) string Description = description(mnFrom) bool OK = copy(ModName_,string NameToBase, string Description) ModName mnTo = module(full name of NameToBase) string ErrMess = move(ModName_,Folder) string ErrMess = rename(ModName_,string NameToBase,string Description)
Hi Louie, I fixed it with the following code:
void copyTemplates(Folder f)
{
string new = get(newImp)//get new folder name from dialog
string x = "Parent folder location"
string y = new
string z = x y //concat parent and new folder for full path
Item itemRef
int i = 0
for itemRef in (current Folder) do
{
i++
clipCopy(itemRef)//copy reference modules.
clipPaste( folder z ) //Paste in designated implementation folder
clipClear() // Clear clipboard
}
}
|
Re: Copy module between folders mwilliamson - Thu Jun 17 12:17:30 EDT 2010 Hi Louie, I fixed it with the following code:
void copyTemplates(Folder f)
{
string new = get(newImp)//get new folder name from dialog
string x = "Parent folder location"
string y = new
string z = x y //concat parent and new folder for full path
Item itemRef
int i = 0
for itemRef in (current Folder) do
{
i++
clipCopy(itemRef)//copy reference modules.
clipPaste( folder z ) //Paste in designated implementation folder
clipClear() // Clear clipboard
}
}
|
Re: Copy module between folders llandale - Thu Jun 17 12:56:47 EDT 2010 Views and access rights get copied but baselines don't. Not sure about triggers as I tend to avoid them wherever possible! Mark |
Re: Copy module between folders llandale - Thu Jun 17 11:59:30 EDT 2010 I don't seem to have an example of it, but ModName_ mnFrom = module(NameFromFull) string Description = description(mnFrom) bool OK = copy(ModName_,string NameToBase, string Description) ModName mnTo = module(full name of NameToBase) string ErrMess = move(ModName_,Folder) string ErrMess = rename(ModName_,string NameToBase,string Description)
Hi Louie, What if the user doesn't have the right to create a module in the current Folder but only in the target Folder ? The only solution I have found so far (except Mark's solution with the clipboard) is to use a script from the Kitchen ("duplicate.dxl", which also uses other functions from other Kitchen files) and adapt it a little for my needs. FYI, that script creates an empty module at the target location, then copies every object from the old module depending on its absolute number, then moves every object using the "Object Number" information from the old module, and finally sets the correct level for every object, and I'm skipping the details about tables and deleted objects! As it appears it doesn't even copy module attributes nor views (these aspects can be easily fixed using other Kitchen functions, though). That seems pretty complicated compared to the "copy" function, therefore I just can't believe that there is no easier way than that... I guess the clipboard will be my friend for that matter if you don't know of any better solution... Thanks, Thomas
|
Re: Copy module between folders mwilliamson - Thu Jun 17 12:17:30 EDT 2010 Hi Louie, I fixed it with the following code:
void copyTemplates(Folder f)
{
string new = get(newImp)//get new folder name from dialog
string x = "Parent folder location"
string y = new
string z = x y //concat parent and new folder for full path
Item itemRef
int i = 0
for itemRef in (current Folder) do
{
i++
clipCopy(itemRef)//copy reference modules.
clipPaste( folder z ) //Paste in designated implementation folder
clipClear() // Clear clipboard
}
}
Hello Mark, I tried the following code. But could not copy the module between the folders. Thanks & Regards.
|
Re: Copy module between folders Dear all,
I'm new to dxl scripting, and I've been trying to copy a module from one project folder, to a different project folder. I used the examples above, but so far I haven't obtained any success. Here's how my script looks like: // originalModule is a the path of the original file to be copied. // targetPath is the path of the target project location of where the module should // be pasted ModName_ originalMMP = module(originalModule) string originalMMPdesc = description(originalMMP) clipCopy(originalMMP) // Not sure If I should be using paths here, but got the same error. clipPaste(targetPath) clipClear() // copiedModule is the path of the pasted module // This is an attempt of renaming the pasted file. ModName_ copiedMMP = module(copiedModule) ErrMess = rename(copiedMMP,newModuleName, originalMMPdesc) Any ideas of what could be possibly going wrong? I'm not entirely sure of how the clipCopy and clipPaste work. I've been getting "incorrect arguments for functions" for both of them.
Thank you for your time, Alex |
Re: Copy module between folders mwilliamson - Thu Jun 17 12:17:30 EDT 2010 Hi Louie, I fixed it with the following code:
void copyTemplates(Folder f)
{
string new = get(newImp)//get new folder name from dialog
string x = "Parent folder location"
string y = new
string z = x y //concat parent and new folder for full path
Item itemRef
int i = 0
for itemRef in (current Folder) do
{
i++
clipCopy(itemRef)//copy reference modules.
clipPaste( folder z ) //Paste in designated implementation folder
clipClear() // Clear clipboard
}
}
what about archive/restore? |